/*5：输出一个空心的等腰三角形，高度由用户输入，周围由 *组成，空格的数目分别是0，1,2,3,.....
比如，如下是一个高度为5的图形
       *
      * *
     *   *
    *     *
   **********/
package ZUOYE0424;

import java.util.Scanner;

public class Task5 {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		System.out.println("输入高度：");
		int h = in.nextInt();
		for (int a = 1; a <= h; a++) {
			for (int b = 1; b <= h - a + 1; b++) {
				System.out.print(" ");
			}
			System.out.print("*");
			if (a > 1 && a < h) {
				for (int c = 1; c <= (a - 2) * 2 + 1; c++) {
					System.out.print(" ");
				}
				System.out.print("*");
			} else if (a == h) {
				for (int d = 1; d <= 2 * h - 2; d++) {
					System.out.print("*");
				}
			}
			System.out.println();
		}

	}

}
